<script setup>
import useCounterStore from "@/pinia/stores/counter";
import {storeToRefs} from "pinia";
const counterStore=useCounterStore()
const {counter,doubleCounter,doubleCounterAdd,getUserById,getUserStoreName}=storeToRefs(counterStore)
const change=()=>{
  counterStore.counter++
}
</script>

<template>
  <div class="layui-panel">
    <h1>home组件</h1>
    <h3>useCounterStore中state的counter值是：{{ counter }}</h3>
    <h3>useCounterStore中getters的doubleCounter值是：{{ doubleCounter }}</h3>
    <h3>useCounterStore中getters的doubleCounterAdd值是：{{ doubleCounterAdd }}</h3>
    <h3>useCounterStore的userList查找id为1的对象：{{ getUserById(2) }}</h3>
    <h3>userStore的name为：{{ getUserStoreName }}</h3>
    <button type="button" class="layui-btn layui-btn-normal" @click="change">修改counter</button>
  </div>
</template>

<style scoped lang="less"></style>